<?php
namespace App\Services\Qrcode;
use App\Services\Qrcode\Qrcode\QrcodeLogic;
/**
 * @Author: ws
 * @Date:   2018-06-12 16:23:45
 * @Last Modified by:   Marte
 */
class Qrcode
{
    //生成二维码 可设置大小
    public function createQrCode($data)
    {
        $data = init_array($data,["token"=>" ", "appkey"=>" ", "type"=>" ", "code_id"=>" ", "url"=>" ", "size"=>"6"]);
        ValidateQrcode::checkValidate($data, ['token','appkey','type','code_id','url']);
        return (new QrcodeLogic())->createQrCode($data);
    }

    //获取二维码
    public function gainQrCode($data)
    {
        $data = init_array($data,["token"=>"", "appkey"=>"", "type"=>"", "code_id"=>""]);
        ValidateQrcode::checkValidate($data, ['token','appkey','type','code_id']);
        return (new QrcodeLogic())->gainQrCode($data);
    }

}
